package com.hdu.point_offer;


public class lcr128 {
    class Solution {
        public int stockManagement(int[] stock) {
            int l = 0, r = stock.length - 1;
            while (l < r)
            {
                int mid = l + ((r - l) >> 1);
                if (stock[mid] > stock[r]) l = mid + 1;
                else if (stock[mid] == stock[r])
                {
                    r--;
                }
                else
                {
                    // stock[mid] < stock[r]
                    r = mid;
                }
            }
            return stock[l];
        }
    }
}
